/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay.a;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.qihoo.gamecenter.sdk.pay.d;
import com.qihoo.gamecenter.sdk.pay.k.c;
import com.qihoo.gamecenter.sdk.pay.view.PayRecordListItemView;
import java.util.ArrayList;

public class a extends BaseAdapter {
    private ArrayList a;
    private Context b;
    private Intent c;
    private int d = -1;
    private View e = null;
    private long f = 0L;

    public a(Context paramContext, Intent paramIntent) {
        this.b = paramContext;
        this.a = new ArrayList();
        this.c = paramIntent;
    }

    public int getCount() {
        return ((this.a != null) ? this.a.size() : 0);
    }

    public d a(int paramInt) {
        int i = getCount();
        if ((i > 0) && (paramInt >= 0) && (paramInt < i))
            return ((d) this.a.get(paramInt));
        return null;
    }

    public long getItemId(int paramInt) {
        if ((paramInt >= 0) && (paramInt < getCount()))
            return paramInt;
        return -1L;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
        a locala;
        if (paramView == null) {
            locala = new a();
            paramView = new PayRecordListItemView(this.b, this.c);
            locala.a = ((PayRecordListItemView) paramView);
            paramView.setTag(locala);
        }
        else {
            locala = (a) paramView.getTag();
        }
        if (this.d == paramInt) {
            locala.a.a(a(paramInt));
            this.e = locala.a;
            c.a("PayRecordAdapter", new Object[] { "mLastClickedView=", this.e, " pos=", Integer.valueOf(paramInt) });
        }
        else {
            locala.a.a();
        }
        locala.a.a(a(paramInt), this.f);
        return paramView;
    }

    public void a(ArrayList paramArrayList) {
        if ((paramArrayList == null) || (paramArrayList.isEmpty())) {
            this.d = -1;
            this.e = null;
        }
        this.a = paramArrayList;
        notifyDataSetChanged();
        c.a("PayRecordAdapter", new Object[] { "setData: records size=", Integer.valueOf(getCount()) });
    }

    public void b(int paramInt) {
        this.d = paramInt;
        if ((paramInt < 0) || (paramInt >= getCount()))
            return;
        a(paramInt).a(true);
    }

    public View a() {
        return this.e;
    }

    public void a(View paramView, int paramInt) {
        c.a("PayRecordAdapter", new Object[] { "-----------> showExpendview, pos = ", Integer.valueOf(paramInt) });
        if (!(paramView instanceof PayRecordListItemView))
            return;
        PayRecordListItemView localPayRecordListItemView = (PayRecordListItemView) paramView;
        localPayRecordListItemView.a(a(paramInt));
        this.e = paramView;
    }

    public void a(View paramView) {
        if (!(paramView instanceof PayRecordListItemView))
            return;
        PayRecordListItemView localPayRecordListItemView = (PayRecordListItemView) paramView;
        localPayRecordListItemView.a();
    }

    public boolean b(View paramView) {
        if (paramView instanceof PayRecordListItemView) {
            PayRecordListItemView localPayRecordListItemView = (PayRecordListItemView) paramView;
            return localPayRecordListItemView.b();
        }
        return false;
    }

    public void a(long paramLong) {
        this.f = paramLong;
    }

    static class a {
        PayRecordListItemView a;
    }
}